package com.abss.vote.mapper;

import com.abss.vote.model.Comment;
import com.abss.vote.model.Work;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CommentMapper {

    //查询一级评论
    List<Comment> getOneComment(@Param("start")int start,@Param("end") int end,@Param("work_id")Integer work_id);

    //查询二级评论
    List<Comment> getTwoComment(@Param("work_id")Integer work_id,@Param("p_id")Integer p_id);

    //插入评论
    int insertComment(Comment comment);

    //获取用户信息
    Comment getUser(@Param("user_id")String user_id);

    //判断是否是作者
    Work IsAuthor(Comment comment);

    //获取被评论者的id
    String getBe_User_ID(@Param("parent_id")Integer parent_id);

    //回复
    int insertReply(Comment comment);

    //回台获取作品名称
    String getWorkName(@Param("work_id")Integer work_id);

    List<Comment> getOneCommentBack(@Param("work_id")Integer work_id);

    int getCount(@Param("work_id")Integer work_id);

    Comment getAdmin(@Param("server_id")String server_id, @Param("admin")String admin);

    int setCommentBack(Comment comment);

    int setReplyBack(Comment comment);
}
